package kr.or.common.error;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

public class CustomExceptionResolver implements HandlerExceptionResolver {

	private String view = null;
	public void setView(String view) {
		this.view = view;
	}
	
	public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object obj, Exception exception) {
		
		// 에러 메시지를 화면에 전달한다.
		request.setAttribute("exception", exception);
		
		// 오류사항을 관리자에게 메일로 보낸다.
		
		return new ModelAndView(view);
	}
}
